package com.heima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heima.health.pojo.CheckGroup;
import com.heima.health.vo.CheckGroupVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface CheckGroupMapper extends BaseMapper<CheckGroup> {

    @Insert("INSERT INTO t_checkgroup_checkitem VALUES(#{gid},#{cid});")
    void insertCidByGId(@Param("gid") Integer gid, @Param("cid") Integer itemId);

    @Select("SELECT CHECKITEM_ID FROM t_checkgroup_checkitem WHERE CHECKGROUP_ID=#{gid}")
    Integer[] findIds(@Param("gid")Integer gid);

    @Select("select id,code,name,sex,HELPCODE,ATTENTION,remark from t_checkgroup where id = #{gid}")
    CheckGroupVO findById(@Param("gid")Integer gid);

    @Delete("delete from t_checkgroup_checkitem where CHECKGROUP_ID = #{gid}")
    void deleteCidByGid(@Param("gid")Integer gid);
}
